# -*- coding: UTF-8 -*-

"""Definition of the jiaxiao content type
"""

from zope.interface import implements

from Products.Archetypes import atapi
#from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import folder
from Products.ATContentTypes.content import schemata

# -*- Message Factory Imported Here -*-
from my315ok.xtjxwcontents import xtjxwcontentsMessageFactory as _

from my315ok.xtjxwcontents.interfaces import Ijiaxiao
from my315ok.xtjxwcontents.config import PROJECTNAME

jiaxiaoSchema = folder.ATFolderSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-




    atapi.StringField(
        'name',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"Name"),
            description=_(u"jiaxiao name"),
        ),
        required=True,
    ),



    atapi.IntegerField(
        'price',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"youhuijiage"),
            description=_(u"youhuijiage"),
        ),
        required=True,
        default=3300,
        validators=('isInt'),
    ),

    atapi.TextField(
        'shoufeibiaozhun',
        storage=atapi.AnnotationStorage(),
        default_output_type='text/html',
        widget=atapi.RichWidget(
            label=_(u"shoufeibiaozhun"),
            rows=3,
            description=_(u""),
        ),
        required=True,
        default=u"3800元",
    ),

    atapi.StringField(
        'district',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtjxw.bigarea",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"diqu"),
            description=_(u"suoshudiqu"),           
        ),
        required=True,
        default="xiangtanshihexi",
    ),


 atapi.FloatField(
        'longitude',
        storage=atapi.AnnotationStorage(),
        widget=atapi.DecimalWidget(
            label=_(u"longitude"),
            description=_(u""),
        ),
        default=112.885666,
        validators=('isDecimal'),
    ),


    atapi.FloatField(
        'latitude',
        storage=atapi.AnnotationStorage(),
        widget=atapi.DecimalWidget(
            label=_(u"latitude"),
            description=_(u""),
        ),
        default=27.879506,
        validators=('isDecimal'),
    ),
    
    atapi.StringField(
        'luxian',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"luxian"),
            description=_(u"laixiaoluxian"),
        ),
    ),    
    
    atapi.IntegerField(
        'shebeizhishu',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"shebeizhishu"),
            description=_(u"shebeizhishu,0-10,10 is the best"),
        ),
        default=5,
        validators=('isInt'),
    ),


    atapi.IntegerField(
        'weizhizhishu',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"weizhizhishu"),
            description=_(u"weizhizhishu,0-10,10 is the best"),
        ),
        default=5,
        validators=('isInt'),
    ),


    atapi.IntegerField(
        'shoufei',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"shoufeizhishu"),
            description=_(u"shoufeizhishu,0-10,10 is the best"),
        ),
        default=5,
        validators=('isInt'),
    ),


    atapi.IntegerField(
        'fuwuzhishu',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"fuwuzhishu"),
            description=_(u"fuwuzhishu"),
        ),
        default=5,
        validators=('isInt'),
    ),


    atapi.TextField(
        'aircontrol_running',
        storage=atapi.AnnotationStorage(),
        widget=atapi.TextAreaWidget(
            label=_(u"kailengshijian"),
            description=_(u"kailengshijian"),
        ),
        default=u"三个月",
    ),


    atapi.TextField(
        'contact_info',
        storage=atapi.AnnotationStorage(),
        widget=atapi.TextAreaWidget(
            label=_(u"contact information"),
            description=_(u"contact information"),
        ),
        required=True,
        default="13873298832",
    ),


    atapi.IntegerField(
        'renqizhishu',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"renqizhishu"),
            description=_(u"0-10,10 is the heightest"),
        ),
        default=5,
        validators=('isInt'),
    ),


    atapi.IntegerField(
        'tuijiandu',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"tuijiandu"),
            description=_(u"0-10,10 is the heightest"),
        ),
        default=5,
        validators=('isInt'),
    ),


    atapi.TextField(
        'text',
        storage=atapi.AnnotationStorage(),
        default_output_type='text/html',
        widget=atapi.RichWidget(
            label=_(u"introduction"),
            description=_(u"jiaoxiao introduction"),
        ),
        required=True,
        default="13873298832",
    ),


  

))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

jiaxiaoSchema['title'].storage = atapi.AnnotationStorage()
jiaxiaoSchema['description'].storage = atapi.AnnotationStorage()

jiaxiaoSchema['text'].widget.allow_file_upload=False
jiaxiaoSchema['description'].widget.visible = 0
jiaxiaoSchema['shoufeibiaozhun'].widget.allow_file_upload=False

schemata.finalizeATCTSchema(jiaxiaoSchema, moveDiscussion=False)


class jiaxiao(folder.ATFolder):
    """Description of the Example Type"""
    implements(Ijiaxiao)

    meta_type = "jiaxiao"
    schema = jiaxiaoSchema

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    luxian = atapi.ATFieldProperty('luxian')

    shoufeibiaozhun = atapi.ATFieldProperty('shoufeibiaozhun')

    shebeizhishu = atapi.ATFieldProperty('shebeizhishu')

    weizhizhishu = atapi.ATFieldProperty('weizhizhishu')

    shoufei = atapi.ATFieldProperty('shoufei')

    fuwuzhishu = atapi.ATFieldProperty('fuwuzhishu')

    price = atapi.ATFieldProperty('price')

    district = atapi.ATFieldProperty('district')

    aircontrol_running = atapi.ATFieldProperty('aircontrol_running')

    contact_info = atapi.ATFieldProperty('contact_info')

    renqizhishu = atapi.ATFieldProperty('renqizhishu')

    tuijiandu = atapi.ATFieldProperty('tuijiandu')

    text = atapi.ATFieldProperty('text')

    name = atapi.ATFieldProperty('name')
    
    longitude = atapi.ATFieldProperty('longitude')

    latitude = atapi.ATFieldProperty('latitude')


atapi.registerType(jiaxiao, PROJECTNAME)
